import Dexie, { Table } from 'dexie';
import { Cart } from '../../store/cart';
import { Shop } from '../../pages/goods/goods.model';
import { Stores } from '../../pages/seller/seller.model';
import { Order } from '../../pages/order/order.model';

export class AppDB extends Dexie {
  cartList!: Table<Cart, number>;
  shopList!: Table<Shop, number>;
  storesList!: Table<Stores, number>;
  orderList!: Table<Order, number>;

  constructor() {
    super('demo-qiankun-database');
    this.version(3).stores({
      shopList: '++id',
      storesList: '++id',
      cartList: '++id',
      orderList: '++id',
    });
  }
}

export const db = new AppDB();
